<template>
  <!-- 占位容器 -->
  <div class="charts" ref="charts"></div>
</template>

<script>
import echarts from "echarts";
export default {
  name: "barCharts",
  mounted() {
    // 基于准备好的dom，初始化echarts实例
    let barCharts = echarts.init(this.$refs.charts);
    // 绘制图表
    //配置数据
    barCharts.setOption({
      xAxis: {
        //隐藏x轴
        show: false,
        // 离散的类目数据
        type: "category",
      },
      yAxis: {
        //隐藏y轴
        show: false,
      },
      //系列
      series: [
        {
          type: "bar",
          data: [10, 7, 33, 12, 9, 29, 10, 44],
          color: "cyan"
        }
      ],
      //布局调试
      grid: {
        left: 0,
        top: 0,
        right: 0,
        bottom: 0,
      },
    });
  },
};
</script>

<style>
.charts {
  width: 100%;
  height: 100%;
}
</style>